package com.shujia.day20;


/*
    1. 创建枚举类的属性(成员遍历)，必须是作为私有常量出现
    2. 必须将构造方法私有化，这是为了保证类的对象是有限个的目的
    3. 提供公共的静态的final方法给外界获取枚举类中多个对象
    4. 提供公共的获取属性的方法
    5. 重写toString()方法

 */
class Season{
    //1. 创建枚举类的属性(成员遍历)，必须是作为私有常量出现
    private String name;
    private String info;

    //2. 必须将构造方法私有化，这是为了保证类的对象是有限个的目的
    private Season(String name, String info){
        this.name = name;
        this.info = info;
    }

    //3. 提供公共的静态的final方法给外界获取枚举类中多个对象
    public static final Season SPRING = new Season("春天","春暖花开");
    public static final Season SUMMER = new Season("夏天","烈日炎炎");
    public static final Season AUTUMN = new Season("秋天","秋高气爽");
    public static final Season WINTER = new Season("冬天","白雪皑皑");

    //4. 提供公共的获取属性的方法


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    @Override
    public String toString() {
        return "Season{" +
                "name='" + name + '\'' +
                ", info='" + info + '\'' +
                '}';
    }
}

public class SeasonDemo1 {
    public static void main(String[] args) {
        Season spring = Season.SPRING;
        Season summer = Season.SUMMER;

    }
}
